/**
 * Created by Administrator on 2017/3/22 0022.
 */
var Page0={
    create:function () {
        var page={};
        page.ui=new PIXI.DisplayObjectContainer();

        var bg=new PIXI.Graphics();
        bg.beginFill(0x0,1);
        bg.drawRect(0,0,pixiStageW,pixiStageH);
        bg.endFill();
        page.ui.addChild(bg);

        var t0=new PIXI.Sprite(resource['assets/images/p0_t0.png'].texture);
        t0.anchor.set(0.5);
        t0.x=pixiStageW/2;
        page.ui.addChild(t0);

        var t1=new PIXI.Sprite(resource['assets/images/p0_t1.png'].texture);
        t1.anchor.set(0.5);
        t1.x=pixiStageW/2;
        page.ui.addChild(t1);

        var t2=new PIXI.Sprite(resource['assets/images/p0_t2.png'].texture);
        t2.anchor.set(0.5);
        t2.x=pixiStageW/2;
        t2.y=462;
        page.ui.addChild(t2);

        var _mask=new PIXI.Graphics();
        _mask.beginFill(0x0,1);
        _mask.drawRect(0,0,648,144);
        _mask.endFill();
        _mask.x=-420;
        _mask.y=388;
        page.ui.addChild(_mask);

        t2.mask=_mask;
        console.log('haha')
        page.In=function()
        {
            console.log('In')
            t0.alpha=0;
            t0.y=pixiStageH/2+50;
            TweenMax.to(t0,1.2,{delay:1.0,y:pixiStageH/2,alpha:1,ease:Cubic.easeInOut});
            TweenMax.to(t0,1.2,{delay:3,y:pixiStageH/2-50,alpha:0.5,ease:Cubic.easeInOut});

            t1.alpha=0;
            t1.y=pixiStageH/2+50;
            TweenMax.to(t1,1.2,{delay:3,y:pixiStageH/2,alpha:1,ease:Cubic.easeInOut});

            TweenMax.to(_mask,3,{delay:4.5,x:244});

            setTimeout(function()
            {
                var arr=[1,0]
                var event = new CustomEvent("Game_PageIn",{'detail':arr});
                document.dispatchEvent(event);
            },9000);
        }


        return page;
    }
}
